package com.qianying;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;

public class CodeGenerator {

    public static void main(String[] args) {
       /*FastAutoGenerator.create(
                        "jdbc:mysql://rm-f8zu9ruo6j8dy1ztwfo.mysql.rds.aliyuncs.com:3306/qianying?useSSL=false&serverTimezone=Asia/Shanghai",
                        "root",
                        "QianYing@1688")
                .globalConfig(builder -> {
                    builder.author("check") // 作者
                            .outputDir(System.getProperty("user.dir") + "/" + "src/main/java") // 输出路径
                            .commentDate("yyyy-MM-dd");
                })
                .packageConfig(builder -> {
                    Map<OutputFile, String> pathMap = new HashMap<>();
                    pathMap.put(OutputFile.xml, System.getProperty("user.dir") + "/src/main/resources/mapper");
                    pathMap.put(OutputFile.mapper, System.getProperty("user.dir") + "/src/main/java/com/qianying/mapper");

                    builder.parent("com.qianying")
                            .moduleName("")
                            .pathInfo(pathMap);
                })
                .strategyConfig(builder -> {
                    builder.addInclude("work_order") // 指定生成哪张表，可写多个
                            .entityBuilder()
                            .enableLombok()
                            .naming(NamingStrategy.underline_to_camel) // 表字段下划线转驼峰
                            .columnNaming(NamingStrategy.underline_to_camel)
                            .mapperBuilder()
                            .enableBaseResultMap()
                            .enableBaseColumnList()
                            .formatMapperFileName("%sMapper")
                            .enableMapperAnnotation()
                            .controllerBuilder()
                            .enableRestStyle();
                })
                .execute();*/
    }
}
